package com.example.emos.api.service.impl;

import com.example.emos.api.common.util.PageUtils;
import com.example.emos.api.db.dao.TbEvaluationDao;
import com.example.emos.api.db.dao.TbRankDao;
import com.example.emos.api.db.pojo.TbExamEva;
import com.example.emos.api.db.pojo.TbExamEvaGroup;
import com.example.emos.api.db.pojo.TbRank;
import com.example.emos.api.service.EvaluationService;
import com.example.emos.api.service.RankService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;

/**
 * @author ：Supyo
 * @date ：Created in 2021/11/16 15:03
 * @description：
 */
@Service
public class RankServiceImpl implements RankService {
    @Autowired
    TbRankDao rankDao;

    @Override
    public PageUtils selectRankBypages(HashMap param) {
        ArrayList<HashMap> list = rankDao.selectRankBypages(param);
        long count = rankDao.count();
        int start = (Integer) param.get("start");
        int length = (Integer) param.get("length");
        PageUtils pageUtils = new PageUtils(list, count, start, length);
        return pageUtils;
    }

    @Override
    public int addRanks(TbRank rank) {
        int rows = rankDao.addRanks(rank);
        return rows;
    }

    @Override
    public int updateRank(HashMap param) {
        int rows = rankDao.updateRank(param);
        return rows;
    }

    @Override
    public int deleteRanks(Integer[] ids) {
        int rows = rankDao.deleteRanks(ids);
        return rows;
    }

    @Override
    public TbRank selectOneRank(Integer id) {
        TbRank map = rankDao.selectOneRank(id);
        return map;
    }

}
